import { Code } from '@/utils/request/type'

export function resultSuccess(data = {}, msg: string = 'success', code: Code = Code.SUCCESS) {
  return result(code, msg, data)
}

export function resultError(msg: string = 'error', code: Code = Code.ERROR, data = {}) {
  return result(code, msg, data)
}

export function result(code: Code, msg: string = 'result', data = {}) {
  return {
    code,
    msg,
    data,
  }
}
